package cn.edu.scau.dropship.mapper;

import cn.edu.scau.dropship.entity.Data_dictionary;
import cn.edu.scau.dropship.entity.Data_dictionaryExample;
import java.util.List;
import org.apache.ibatis.annotations.Arg;
import org.apache.ibatis.annotations.ConstructorArgs;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;

public interface Data_dictionaryMapper {
    @SelectProvider(type=Data_dictionarySqlProvider.class, method="countByExample")
    long countByExample(Data_dictionaryExample example);

    @DeleteProvider(type=Data_dictionarySqlProvider.class, method="deleteByExample")
    int deleteByExample(Data_dictionaryExample example);

    @Delete({
        "delete from data_dictionary",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(Integer id);

    @Insert({
        "insert into data_dictionary (id, dict_type, ",
        "dict_description, code, ",
        "code_value, admin_id)",
        "values (#{id,jdbcType=INTEGER}, #{dictType,jdbcType=VARCHAR}, ",
        "#{dictDescription,jdbcType=VARCHAR}, #{code,jdbcType=VARCHAR}, ",
        "#{codeValue,jdbcType=VARCHAR}, #{adminId,jdbcType=INTEGER})"
    })
    int insert(Data_dictionary record);

    @InsertProvider(type=Data_dictionarySqlProvider.class, method="insertSelective")
    int insertSelective(Data_dictionary record);

    @SelectProvider(type=Data_dictionarySqlProvider.class, method="selectByExample")
    @ConstructorArgs({
        @Arg(column="id", javaType=Integer.class, jdbcType=JdbcType.INTEGER, id=true),
        @Arg(column="dict_type", javaType=String.class, jdbcType=JdbcType.VARCHAR),
        @Arg(column="dict_description", javaType=String.class, jdbcType=JdbcType.VARCHAR),
        @Arg(column="code", javaType=String.class, jdbcType=JdbcType.VARCHAR),
        @Arg(column="code_value", javaType=String.class, jdbcType=JdbcType.VARCHAR),
        @Arg(column="admin_id", javaType=Integer.class, jdbcType=JdbcType.INTEGER)
    })
    List<Data_dictionary> selectByExample(Data_dictionaryExample example);

    @Select({
        "select",
        "id, dict_type, dict_description, code, code_value, admin_id",
        "from data_dictionary",
        "where id = #{id,jdbcType=INTEGER}"
    })
    @ConstructorArgs({
        @Arg(column="id", javaType=Integer.class, jdbcType=JdbcType.INTEGER, id=true),
        @Arg(column="dict_type", javaType=String.class, jdbcType=JdbcType.VARCHAR),
        @Arg(column="dict_description", javaType=String.class, jdbcType=JdbcType.VARCHAR),
        @Arg(column="code", javaType=String.class, jdbcType=JdbcType.VARCHAR),
        @Arg(column="code_value", javaType=String.class, jdbcType=JdbcType.VARCHAR),
        @Arg(column="admin_id", javaType=Integer.class, jdbcType=JdbcType.INTEGER)
    })
    Data_dictionary selectByPrimaryKey(Integer id);

    @UpdateProvider(type=Data_dictionarySqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") Data_dictionary record, @Param("example") Data_dictionaryExample example);

    @UpdateProvider(type=Data_dictionarySqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") Data_dictionary record, @Param("example") Data_dictionaryExample example);

    @UpdateProvider(type=Data_dictionarySqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(Data_dictionary record);

    @Update({
        "update data_dictionary",
        "set dict_type = #{dictType,jdbcType=VARCHAR},",
          "dict_description = #{dictDescription,jdbcType=VARCHAR},",
          "code = #{code,jdbcType=VARCHAR},",
          "code_value = #{codeValue,jdbcType=VARCHAR},",
          "admin_id = #{adminId,jdbcType=INTEGER}",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(Data_dictionary record);
}